package com.laery0.xixin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.laery0.xixin.mapper.OverallResultMapper;
import com.laery0.xixin.po.OverallResult;
import com.laery0.xixin.po.ResponseBean;
import com.laery0.xixin.service.OverallResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OverallResultServiceImpl implements OverallResultService {
    @Autowired
    private OverallResultMapper overallResultMapper;

    @Override
    public ResponseBean<List<OverallResult>> listOverallResultByOrderId(Integer orderId) {
        QueryWrapper<OverallResult> queryWrapper = new QueryWrapper<OverallResult>().eq("orderid", orderId);
        List<OverallResult> overallResultList = overallResultMapper.selectList(queryWrapper);
        if (overallResultList != null && overallResultList.size() > 0) {
            return new ResponseBean<>(overallResultList);
        } else {
            return new  ResponseBean<>(601, "没有找到id为:" + orderId + "的体检整体结论");
        }
    }
}
